home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nvlexp / password.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-05  |  4.6 KB  |  142 lines

  1. VERSION 2.00
  2. Begin Form Password 
  3.    Caption         =   "Enter UserID and Password"
  4.    ClientHeight    =   3030
  5.    ClientLeft      =   600
  6.    ClientTop       =   660
  7.    ClientWidth     =   5385
  8.    Height          =   3435
  9.    Left            =   540
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3030
  13.    ScaleWidth      =   5385
  14.    Top             =   315
  15.    Width           =   5505
  16.    Begin CommandButton Command2 
  17.       Caption         =   "Cancel"
  18.       Height          =   495
  19.       Left            =   3300
  20.       TabIndex        =   4
  21.       Top             =   2490
  22.       Width           =   855
  23.    End
  24.    Begin CommandButton Command1 
  25.       Caption         =   "OK"
  26.       Height          =   495
  27.       Left            =   1380
  28.       TabIndex        =   3
  29.       Top             =   2490
  30.       Width           =   855
  31.    End
  32.    Begin TextBox Text3 
  33.       BorderStyle     =   0  'None
  34.       FontBold        =   -1  'True
  35.       FontItalic      =   0   'False
  36.       FontName        =   "MS Sans Serif"
  37.       FontSize        =   13.5
  38.       FontStrikethru  =   0   'False
  39.       FontUnderline   =   0   'False
  40.       Height          =   360
  41.       Left            =   2250
  42.       TabIndex        =   2
  43.       Top             =   1830
  44.       Width           =   2025
  45.    End
  46.    Begin TextBox Text2 
  47.       BorderStyle     =   0  'None
  48.       FontBold        =   -1  'True
  49.       FontItalic      =   0   'False
  50.       FontName        =   "MS Sans Serif"
  51.       FontSize        =   13.5
  52.       FontStrikethru  =   0   'False
  53.       FontUnderline   =   0   'False
  54.       Height          =   360
  55.       Left            =   2250
  56.       TabIndex        =   1
  57.       Top             =   1170
  58.       Width           =   2025
  59.    End
  60.    Begin TextBox Text1 
  61.       BorderStyle     =   0  'None
  62.       FontBold        =   -1  'True
  63.       FontItalic      =   0   'False
  64.       FontName        =   "MS Sans Serif"
  65.       FontSize        =   9.75
  66.       FontStrikethru  =   0   'False
  67.       FontUnderline   =   0   'False
  68.       Height          =   315
  69.       Left            =   2250
  70.       TabIndex        =   0
  71.       Top             =   570
  72.       Width           =   1725
  73.    End
  74. DefInt A-Z
  75. Dim TxthWnd As Integer, WindowLong As Long
  76. Sub Command1_Click ()
  77.     TmpTxt$ = Text1.Text: Text1.Text = AllTrim(TmpTxt$)
  78.     TmpTxt$ = Text2.Text: Text2.Text = AllTrim(TmpTxt$)
  79.     TmpTxt$ = Text3.Text: Text3.Text = AllTrim(TmpTxt$)
  80.     If Text1.Text = "" Then
  81.         Txt$ = "You cannot have a blank user ID"
  82.         MsgBox Txt$, 32, "UserID"
  83.         Exit Sub
  84.     End If
  85.     If Text2.Text = "" Then
  86.         Txt$ = "You have a blank password.  Is "
  87.         Txt$ = Txt$ + "this correct?"
  88.         Response% = MsgBox(Txt$, 36, "Password Warning")
  89.         If Response% = 7 Then   ' Hit NO
  90.             Exit Sub
  91.         End If
  92.     End If
  93.     If Text2.Text = Text3.Text Then
  94.         MainForm.Hidden1.Text = UCase$(Text1.Text)
  95.         MainForm.Hidden2.Text = UCase$(Text2.Text)
  96.         Unload Password
  97.     Else
  98.         Txt$ = "Passwords do not match"
  99.         MsgBox Txt$, 32, "Passwords"
  100.     End If
  101. End Sub
  102. Sub Command2_Click ()
  103.         MainForm.Hidden1.Text = "***VOID***"
  104.         MainForm.Hidden2.Text = "***VOID***"
  105.         Unload Password
  106. End Sub
  107. Sub Form_Load ()
  108.     Form_Paint
  109. End Sub
  110. Sub Form_Paint ()
  111.     TmpTxt$ = "UserID:  "
  112.     Password.CurrentX = Password.Text1.Left - TextWidth(TmpTxt$)
  113.     Password.CurrentY = Password.Text1.Top + 20
  114.     Password.Print TmpTxt$
  115.     TmpTxt$ = "Enter Password:  "
  116.     Password.CurrentX = Password.Text2.Left - TextWidth(TmpTxt$)
  117.     Password.CurrentY = Password.Text2.Top
  118.     Password.Print TmpTxt$
  119.     TmpTxt$ = "Re-Enter Password:  "
  120.     Password.CurrentX = Password.Text3.Left - TextWidth(TmpTxt$)
  121.     Password.CurrentY = Password.Text3.Top
  122.     Password.Print TmpTxt$
  123. End Sub
  124. Sub Text2_GotFocus ()
  125.     numChars = 14
  126.     dummy& = SendMessage(GetFocus(), EM_LIMITTEXT, numChars, ByVal 0&)
  127.     TxthWnd = GetFocus()
  128.     WindowLong = GetWindowLong(TxthWnd, GWL_STYLE)
  129.     WindowLong = WindowLong Or ES_PASSWORD
  130.     WindowLong = SetWindowLong(TxthWnd, GWL_STYLE, WindowLong)
  131.     WindowLong = SendMessage(TxthWnd, EM_SETPASSWORD, ASTERICK, ByVal 0&)
  132. End Sub
  133. Sub Text3_GotFocus ()
  134.     numChars = 14
  135.     dummy& = SendMessage(GetFocus(), EM_LIMITTEXT, numChars, ByVal 0&)
  136.     TxthWnd = GetFocus()
  137.     WindowLong = GetWindowLong(TxthWnd, GWL_STYLE)
  138.     WindowLong = WindowLong Or ES_PASSWORD
  139.     WindowLong = SetWindowLong(TxthWnd, GWL_STYLE, WindowLong)
  140.     WindowLong = SendMessage(TxthWnd, EM_SETPASSWORD, ASTERICK, ByVal 0&)
  141. End Sub
  142.